﻿using System.Web.Http.Dependencies;
using Ninject;

// See http://www.strathweb.com/2012/05/using-ninject-with-the-latest-asp-net-web-api-source/
public class NinjectResolver : NinjectScope, IDependencyResolver
{
    private readonly IKernel kernel;

    public NinjectResolver(IKernel kernel) : base(kernel)
    {
        this.kernel = kernel;
    }

    public IDependencyScope BeginScope()
    {
        return new NinjectScope(this.kernel.BeginBlock());
    }
}